# Contributor: kpcyrd <git@rxv.cc>
# Maintainer: kpcyrd <git@rxv.cc>
pkgname=acmetool
pkgver=0.2.2
pkgrel=8
pkgdesc="An easy-to-use command line tool for automatically acquiring certificates from ACME servers (such as Let's Encrypt)"
url="https://github.com/hlandau/acmetool"
arch="all"
license="MIT"
makedepends="go libcap-dev"
subpackages="$pkgname-doc"
# no test suite available
options="!check net"
source="$pkgname-$pkgver.tar.gz::https://github.com/hlandau/acmetool/archive/v$pkgver.tar.gz
	go.mod
	go.sum
	"

export GOPATH="$srcdir/go"
export GOCACHE="$srcdir/go-build"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

prepare() {
	default_prepare

	cp "$srcdir"/go.mod "$srcdir"/go.sum "$builddir"/
}

build() {
	go build -v \
		-ldflags "-X github.com/hlandau/acmetool/hooks.DefaultPath=/etc/acme/hooks" \
		./cmd/acmetool/...
}

package() {
	install -Dm 755 acmetool "$pkgdir/usr/bin/acmetool"

	install -Dm644 README.md "$pkgdir/usr/share/doc/acmetool/README"
	cp -a _doc/* "$pkgdir/usr/share/doc/$pkgname/"
}

sha512sums="
c24bebbf52664cfda0442db86f8437244322a709413fdd03a79294feac99045f0e06b4342a6186ae4aa400fb627e740f00eadf7522919d3faff4270badb38451  acmetool-0.2.2.tar.gz
4fb8415e5722334259973d320b0c4fc02d0fe58dcec60f6fa1b84a0cee48cd4e1197bcb1f415cdb5bd0ff1cf836d01be9f0b1483012d2e20600deee68bb0797e  go.mod
83365ad021d57386d82bbe4feb40a2da845bd06c13f458ccb75c1945e0588fd7209772b277727e88b4126a6a1f98cf4bf3837c38582070ca0d0f8f18f10f2e4f  go.sum
"
